<%= page_title "Current Deploys" %>

<% if params[:debug].blank? %>
  <section class="tabs" ng-controller="currentDeploysCtrl">
    <%= render 'deploys/table' %>
  </section>
  <%= link_to 'job execution debug info', '?debug=1' %>
<% else %>
  <% active, queued, staggered = JobQueue.debug %>
  <section class="tabs">
    <h2>Active</h2>
    <%= render 'job_executions', job_executions: active %>

    <% if staggered %>
      <h2>Waiting to Start (Staggered)</h2>
      <%= render 'job_executions', job_executions: staggered %>
    <% end %>

    <h2>Queued</h2>
    <%= render 'job_executions', job_executions: queued %>
  </section>
<% end %>
